package com.spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 黄嘉强
 */
@Controller
public class HelloController {

    /**
     * 基于客户端的/hello请求，返回一个hello页面
     * @return
     */
    @RequestMapping("/hello")
    public String doHello(){
        // viewname
        return "hello";
        // prefix+hello+suffix = /templates/hello.html
    }

    /**
     * 基于客户端的/doSayHello请求返回一个字符串
     * @return
     */
    @ResponseBody
    @RequestMapping("/doSayHello")
    public String doSayHello() {
        return "hello Spring MVC";
    }
}
